import json

from ronglian_sms_sdk import SmsSDK
class SmsTool:
    sdk=None
    def __init__(self):
        accId = '8aaf070881ad8ad401821a33b54c1b39'
        accToken = '14fe61527f4a4bacade13e6e8acebebb'
        appId = '8aaf070881ad8ad401821a33b61c1b40'
        self.sdk = SmsSDK(accId, accToken, appId)
    def send_code(self,mobile,code):
        datas=(code,5)
        res=self.sdk.sendMessage('1',mobile,datas)
        res_data=json.loads(res)
        if res_data.get('statusCode')=='000000' or res_data.get('statusCode')=='112310':
            return True
        else:
            return False